home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / Developer Documentation / Recipes, Tech Notes & Articles / Tech Notes / Utilities Documentation / IText < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.9 KB  |  112 lines  |  [TEXT/ttxt]

  1. OpenDocâ„¢ Utilities Documentation
  2.  
  3. ODIText Utilities
  4. by The OpenDoc Design Team
  5.  
  6. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  7. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  8. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  9.  
  10.  
  11. Introduction
  12.  
  13. ODIText is a structure used in OpenDoc to represent international text. ODIText utilities are used to create, destroy and manipulate ODIText.
  14.  
  15.  
  16. ODIText Utilities
  17.  
  18. Functions in italics are overloaded C++ functions for coding convenience.
  19.  
  20. Creation in default heap
  21.  
  22. ODIText* CreateITextCString(ODScriptCode, ODLangCode, char* text);
  23. ODIText* CreateIText(ODScriptCode s, ODLangCode l, char* text);
  24.  
  25. Creates an ODIText using a C string. On the Macintosh, the ODScriptCode and the ODLangCode correspond to the platform script code and language cod.
  26.  
  27. ODIText* CreateITextPString(ODScriptCode, ODLangCode, StringPtr text);
  28. ODIText* CreateIText(ODScriptCode s, ODLangCode l, StringPtr text);
  29.  
  30. Creates an ODIText using a PASCAL string.
  31.  
  32. ODIText* CreateITextClear(  ODScriptCode, ODLangCode, ODSize stringLength );
  33. ODIText* CreateIText(ODScriptCode s, ODLangCode l, ODSize stringLength );
  34.  
  35. Creates an ODIText with an empty string of specified length. 
  36.  
  37. ODIText* CreateITextWLen(ODScriptCode, ODLangCode, ODUByte* text, ODSize textLength );
  38. ODIText* CreateIText(ODScriptCode scriptCode, ODLangCode langCode, ODUByte* text, ODSize textLength)
  39.  
  40. Creates an ODIText with a buffer of characters of specified length.
  41.  
  42. ODIText* SetITextBufferSize( ODIText*, ODSize bufferSize, ODBoolean preserveContents );
  43.  
  44. Sets the buffer size of the ODIText. If the input ODIText is kODNULL, this function is equivalent to CreateITextClear.
  45.  
  46. Destruction
  47.  
  48. void  DisposeIText(ODIText* iText);
  49.  
  50. Disposes an ODIText and any memory associated with it.
  51.  
  52. void  DisposeITextStruct(ODIText iText);
  53.  
  54. This is the same as DisposeIText except that it works on ODIText allocated on the stack.
  55.  
  56. Duplication
  57.  
  58. ODIText* CopyIText(ODIText* original);
  59.  
  60. Allocates and returns an exact copy of the IText passed in.
  61.  
  62. ODIText  CopyITextStruct(ODIText* original);
  63.  
  64. Same as CopyIText except that the ODIText is allocated on the stack.
  65.  
  66. Accessing attributes
  67.  
  68. void  SetITextScriptCode(ODIText*, ODScriptCode);
  69. ODScriptCode GetITextScriptCode(ODIText*);
  70.  
  71. Setter and getter of the script code.
  72.  
  73. void  SetITextLangCode(ODIText*, ODLangCode);
  74. ODLangCode GetITextLangCode(ODIText*);
  75.  
  76. Setter and getter of the language code.
  77.  
  78. ODIText* SetITextStringLength( ODIText*, ODSize length, ODBoolean preserveText );
  79. ODIText* CreateIText(ODSize textLength);
  80.  
  81. Sets the length of the IText string length. If kODNULL is passed in as the input ODIText, the function is equivalent to CreateITextClear.
  82.  
  83. ODULong  GetITextStringLength(ODIText*);
  84.  
  85. Returns the length of the string.
  86.  
  87. Accessing the string
  88.  
  89. char*  GetITextPtr( ODIText* );
  90.  
  91. Returns a pointer to the raw text without allocating any memory. This should be used with extreme caution as the pointer returned belongs to the ODIText struct.
  92.  
  93. void  SetITextCString(ODIText*, char* text);
  94. void SetITextString(ODIText* i, char* text);
  95. void  SetITextPString(ODIText*, StringPtr text);
  96. void  SetITextString(ODIText* i, StringPtr text);
  97. void  SetITextText(ODIText*, ODUByte* text, ODSize textLength);
  98.  
  99. These 3 functions sets the string of the ODIText with a C string, a PASCAL string and a buffer of specified length respectively.
  100.  
  101. char*  GetITextCString(ODIText*, char *cstring);
  102. char* GetITextString(ODIText* i, char* text);
  103. char* GetCStringFromIText(ODIText* iText);
  104.  
  105. Returns a pointer to a C string which corresponds to the string in ODIText. If a string is passed in, the string is used to return the result. Otherwise, this function allocates memory for the returned string.
  106.  
  107. StringPtr GetITextPString(ODIText*, Str255 pstring);
  108. StringPtr GetITextString(ODIText* i, StringPtr text);
  109. StringPtr GetPStringFromIText(ODIText* iText);
  110.  
  111. This function works like GetITextCString except that it returns a PASCAL string.
  112.